﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Skynet.ServiceContracts.MessageContracts;
using Skynet.ServiceContracts.DataContracts;

namespace Skynet.NTModule
{
    public class test
    {
        public void addAuthorTest()
        {
            var context =new  SkynetLibraryRestContext.SkyNetLibraryEntities(new Uri("http://localhost:17079/SkynetLibrary.svc/"));

            StringBuilder sb = new StringBuilder();  
            var lau= from a in context.Authors 
                     where  a.FirstName != "micke"
                     select a;

            foreach (var item in lau)
            {
                sb.AppendLine(item.FirstName);        
            }
            System.Windows.MessageBox.Show(sb.ToString());

            var au = new SkynetLibraryRestContext.Author();            
            au.Id = Guid.NewGuid();
            au.FirstName = "micke";
            au.LastName = "lastname";
            au.WebSite = "www.bing.com";           
            context.AddToAuthors(au);
            context.SaveChanges();
            
        }
    }
}
